package com.yao.myioc.definition;

import java.util.ArrayList;
import java.util.List;

/**
 * bean的定义信息
 *
 * @author Henry Yao
 */
public class BeanDefinition {
    public static final String SINGLETON = "singleton";
    /**
     * bean的名称
     */
    private String beanName;
    /**
     * bean的类型
     */
    private String clazzName;
    /**
     * 作用域
     */
    private String scope;
    /**
     * 初始化方法
     */
    private String initMethod;

    private List<PropertyValue> propertyValues = new ArrayList<>();

    public boolean isSingleton() {
        return SINGLETON.equals(this.scope);
    }

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public String getClazzName() {
        return clazzName;
    }

    public void setClazzName(String clazzName) {
        this.clazzName = clazzName;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getInitMethod() {
        return initMethod;
    }

    public void setInitMethod(String initMethod) {
        this.initMethod = initMethod;
    }

    public BeanDefinition(String clazzName, String beanName) {
        this.beanName = beanName;
        this.clazzName = clazzName;
    }

    public void addPropertyValue(PropertyValue pv) {
        propertyValues.add(pv);
    }

    public void setPropertyValues(List<PropertyValue> propertyValues) {
        this.propertyValues = propertyValues;
    }

    public List<PropertyValue> getPropertyValues() {
        return propertyValues;
    }
}
